﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;

namespace WebUI.Models
{
    public class ProcessModel
    {
        public string ProcessName { get; set; }
        public string SubProcessName { get; set; }
        public string OutFile { get; set; }
        public string ControlFile { get; set; }
        public Periodicity Periodicy { get; set; }
        public string Responsible { get; set; }
        public DateTime EndTime { get; set; }
        public string OriginalControlFile { get; set; }

        public int GetDayByPeriodicity()
        {
            switch (Periodicy)
            {
                case Periodicity.Monthly:
                    return 30;
                case Periodicity.Weekly:
                    return 7;
                default:
                    return 1;
            }
        }
    }

    public enum Periodicity
    {
        Daily, Weekly, Monthly, OnDemand
    }

    public class ProcessFile
    {
        [XmlArray("Processes")]
        [XmlArrayItem("Process")]
        public List<ProcessModel> Processes { get; set; }
    }
}